package com.lc.hongtai.fragment;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lc.hongtai.R;
import com.lc.hongtai.adapter.Fourth_findAdapter2;
import com.lc.hongtai.conn.JsonMsglist;
import com.lc.hongtai.view.FullyLinearLayoutManager;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;
import in.srain.cube.views.ptr.PtrClassicDefaultHeader;
import in.srain.cube.views.ptr.PtrFrameLayout;


@SuppressLint("ValidFragment")
public class SimpleCardFragment extends Fragment {


    String mTitle;
    private RecyclerView.Adapter mAdapter;
    private FullyLinearLayoutManager mLayoutManager;

    private RecyclerView rv01;
    private List<JsonMsglist.Info.ListContent> list = new ArrayList<>();
    private PtrFrameLayout store_house_ptr_frame;
    private PtrClassicDefaultHeader header;

    public int nowPage = 1;
    public int totalPages = 1;
    public int pageSize = 0;
    public int totalRows = 0;

    private boolean canLoadMore = true;

    List<String> mDatas;
    List<String> mDatas2;


    private RecyclerView rv02;

    Fourth_findAdapter2 mAdapter2;
    public static SimpleCardFragment getInstance(String title) {
        SimpleCardFragment sf = new SimpleCardFragment();
        sf.mTitle = title;
        return sf;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fr_simple_card, null);
        ButterKnife.bind(getActivity());
        mDatas = new ArrayList<String>();
        mDatas2=new ArrayList<>();
        rv01 = (RecyclerView) view.findViewById(R.id.rv_01);
        rv01.setLayoutManager(new LinearLayoutManager(getActivity()));
        rv02= (RecyclerView) view.findViewById(R.id.rv_02);
        rv02.setLayoutManager(new LinearLayoutManager(getActivity()));
        //rv01.setAdapter(mAdapter = new Fourth_findAdapter(getActivity(),mDatas));

        for (int i = 'A'; i < 'z'; i++) {
            mDatas.add("" + (char) i);
        }

       /* TextView card_title_tv = (TextView) v.findViewById(R.id.card_title_tv);
        card_title_tv.setText(mTitle);*/

        for (int i=0;i<9;i++){
            mDatas2.add(i+"");
        }
        mAdapter2=new Fourth_findAdapter2(getActivity(),mDatas2);


       // rv02.setAdapter(mAdapter = new Fourth_findAdapter2(getActivity(),mDatas2));
        if (mTitle.equals("经济")){
           // rv01.setAdapter(mAdapter = new Fourth_findAdapter(getActivity(),mDatas));
            rv02.setVisibility(View.GONE);
        }else {
            rv02.setAdapter(mAdapter2);
            rv01.setVisibility(View.GONE);
        }

        return view;
    }



}